package com.ruoyi.receipt.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.receipt.utils.UserInitUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.receipt.mapper.TbKnowledgePlanMapper;
import com.ruoyi.receipt.domain.TbKnowledgePlan;
import com.ruoyi.receipt.service.ITbKnowledgePlanService;

/**
 * 知识点教案Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-03-31
 */
@Service
public class TbKnowledgePlanServiceImpl implements ITbKnowledgePlanService 
{
    @Autowired
    private TbKnowledgePlanMapper tbKnowledgePlanMapper;

    /**
     * 查询知识点教案
     * 
     * @param id 知识点教案ID
     * @return 知识点教案
     */
    @Override
    public TbKnowledgePlan selectTbKnowledgePlanById(Long id)
    {
        return tbKnowledgePlanMapper.selectTbKnowledgePlanById(id);
    }

    @Override
    public TbKnowledgePlan getPlanByManagerId(Long id) {
        return tbKnowledgePlanMapper.getPlanByManagerId(id);
    }

    /**
     * 查询知识点教案列表
     * 
     * @param tbKnowledgePlan 知识点教案
     * @return 知识点教案
     */
    @Override
    public List<TbKnowledgePlan> selectTbKnowledgePlanList(TbKnowledgePlan tbKnowledgePlan)
    {
        return tbKnowledgePlanMapper.selectTbKnowledgePlanList(tbKnowledgePlan);
    }

    /**
     * 新增知识点教案
     * 
     * @param tbKnowledgePlan 知识点教案
     * @return 结果
     */
    @Override
    public int insertTbKnowledgePlan(TbKnowledgePlan tbKnowledgePlan)
    {
        tbKnowledgePlan.setIsDel(0);
        tbKnowledgePlan.setCreateTime(DateUtils.getNowDate());
        UserInitUtils.initUserInfo(tbKnowledgePlan);
        return tbKnowledgePlanMapper.insertTbKnowledgePlan(tbKnowledgePlan);
    }

    /**
     * 修改知识点教案
     * 
     * @param tbKnowledgePlan 知识点教案
     * @return 结果
     */
    @Override
    public int updateTbKnowledgePlan(TbKnowledgePlan tbKnowledgePlan)
    {
        tbKnowledgePlan.setUpdateTime(DateUtils.getNowDate());
        UserInitUtils.initUserInfoForUpdate(tbKnowledgePlan);
        return tbKnowledgePlanMapper.updateTbKnowledgePlan(tbKnowledgePlan);
    }

    @Override
    public int updateTbKnowledgePlanContent(Map<String, Object> map) {
        return tbKnowledgePlanMapper.updateTbKnowledgePlanContent(map);
    }

    /**
     * 批量删除知识点教案
     * 
     * @param ids 需要删除的知识点教案ID
     * @return 结果
     */
    @Override
    public int deleteTbKnowledgePlanByIds(Long[] ids)
    {
        return tbKnowledgePlanMapper.deleteTbKnowledgePlanByIds(ids);
    }

    /**
     * 删除知识点教案信息
     * 
     * @param id 知识点教案ID
     * @return 结果
     */
    @Override
    public int deleteTbKnowledgePlanById(Long id)
    {
        return tbKnowledgePlanMapper.deleteTbKnowledgePlanById(id);
    }
}
